//获取后台的用户值，展示在页面
$(function () {
    var guessLikes = JSON.parse(localStorage.getItem("guessLikes"));
    var string = template("demo", { guessLikes: guessLikes })
    document.getElementById('tb').innerHTML = string;

});
//查询
function doSearch(){
    flag=false;
    var guessLikes = JSON.parse(localStorage.getItem("guessLikes"));
    var inputInner=$("#search").val().trim();
    for(var i=0;i<guessLikes.length;i++){
        if(inputInner==guessLikes[i].title){
            flag=true;
            $("#tb").empty();
            var obj=[guessLikes[i]];
            var string = template("demo", {guessLikes:obj})
            document.getElementById('tb').innerHTML = string;
        }
    }
    if(flag==false){
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.msg('不存在该本书');
            });
        }
}